package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.system.api.RenotePcmService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestHeader;

@Component
public class RemotePcmFallbackFactory implements FallbackFactory<RenotePcmService> {
    private static final Logger log= LoggerFactory.getLogger(RemotePcmFallbackFactory.class);
    @Override
    public RenotePcmService create(Throwable cause) {
        log.error("用户服务调用失败：{}",cause.getMessage());
        return new RenotePcmService() {
            @Override
            public String scbm(String bt, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) {
                String msg="调用成功";
                return msg;
            }
        };
    }
}
